<?php

	require ("class.mcItem.php");
	require ("class.metacritic.php");
	require ("class.metacriticReleaseList.php");
	require ('config.php');
	require ('proxy.php');
	
	global $proxy;
	
	$mc = new metacriticList();
	$mc->useProxy(false);
	if (preg_match('/mrmime/',$_SERVER['HTTP_HOST'])){
		$mc->useProxy(false);
	}
	
	if (isset($_GET['plats'])){
		$storeName = './store/release/'.date('Y-m-d').'_'.$_GET['plats'].'.xml';
		if (file_exists($storeName))
			echo file_get_contents ($storeName);
		
		$mc->setBaseUrl($metaCriticReleaseUrl);
		$mc->setPlatformsSupport($platformsForList);
		$mc->setPlatform($_GET['plats']);
		$mc->setProxy($proxy);
		$mc->parseList();
		echo $mc->renderXML();
	}
	else {
		$mc->setBaseUrl($metaCriticLastReleaseUrl);
		$mc->setPlatform('all');
		$mc->setProxy($proxy);
		$mc->parseTotalReleaseList();
		echo $mc->renderXML();
	}
	
?>